package ModelLayer;
import java.util.ArrayList;


public class Orders
{
    //instance variables
    private static Orders instance = null;
    private static ArrayList<Order> orders;
   
    /**
     * Empty constructor for testing purposes
     */
    
    private Orders()
    {
       orders = new ArrayList<Order>();
    }
    
    /**
     * Singleton static inplementation
     */
    public static Orders getInstance()
    {
        if(instance == null)
      {
        instance = new Orders();
      }
      return instance;
    }
   
    /**
     * Accessor and Mutator methods
     */
    
    public static void addOrder(Order _order)
    {
        orders.add(_order);
    }
    
    public static Order getOrder(String _id)
    {
        Order o = new Order();
        for(int i = 0; i<orders.size(); i++)  
        {
            if (orders.get(i).getId().equals(_id))
                o = orders.get(i);
        }
        return o;
    }
    
    public static Order allOrders(int _index)
    {
        return orders.get(_index);
    }
    
    public static int getSize()
    {
        return orders.size();
    }
        
}
